/*
 * http_headers.l
 * This file is part of gURL
 *
 * Copyright (C) 2014 - Aleksey Konovalov
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Library General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

%{
#include <gtk/gtk.h>
#include "lex_common.h"

#define START_STR_ATTRS "http_headers_startstr", "foreground", "#003153", "weight", PANGO_WEIGHT_BOLD, NULL
#define KEY_ATTRS "http_headers_key", "foreground", "#1a4780", "style", PANGO_STYLE_ITALIC, "font", "monospace", NULL
#define VALUE_ATTRS "http_headers_value", "foreground", "#560319", "font", "monospace", NULL

%}

%option outfile="lex.yy.c"
%option prefix="http_headers"
%option noyywrap
%option reentrant
%option extra-type="struct ParseData*"
%option yylineno

%%
^HTTP.*?$	MARK_TEXT(START_STR_ATTRS);
^[^:\n\r]*?	MARK_TEXT(KEY_ATTRS);
:.*$		MARK_TEXT(VALUE_ATTRS);
%%

void highlight_http_headers(GtkTextBuffer* tb, const gchar* text, size_t len) {
	DO_HIGHLIGHT(http_headers, tb, text, len, FALSE);
}

